package com.three.lab.adapter;


import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.three.lab.R;
import com.three.lab.bean.CommentBean;

import java.util.List;

public class CommentAdapter extends BaseQuickAdapter<CommentBean, BaseViewHolder> {

    public CommentAdapter( @Nullable List<CommentBean> data) {
        super(R.layout.item_list_comment,data);
    }

    public CommentAdapter() {
        super(R.layout.item_list_comment);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, CommentBean item) {
        helper.setText(R.id.tv_name,item.getUserName())
                .setText(R.id.tv_time,item.getTime())
                .setText(R.id.tv_content,item.getContent())
                .setImageResource(R.id.iv_good,item.isGood() ? R.mipmap.ic_good_sel:R.mipmap.ic_good_nor)
                .setImageResource(R.id.iv_bad,item.isBad() ? R.mipmap.ic_bad_sel:R.mipmap.ic_bad_nor)
                .addOnClickListener(R.id.iv_bad,R.id.iv_good);
    }
}
